﻿/*
 * Last review by   : Yaser
 * Last review date : JUL-20-09 
 */
using System;
using System.Collections.Generic;

namespace ERP.Business.DataTypes.Company
{
    /// <summary>
    /// Company
    /// </summary>
    [System.Runtime.Serialization.DataContract]
    [Serializable]
    [System.Runtime.Serialization.KnownType(typeof(Company))]
    public class Company : BaseTypes.BaseType
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Company"/> class.
        /// </summary>
        public Company() { }

        /// <summary>
        /// Initializes a new instance of the <see cref="Company"/> class.
        /// </summary>
        /// <param name="id">The id.</param>
        public Company(Guid id) : base(id) { }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the contracts.
        /// </summary>
        /// <value>The contracts.</value>
        [System.Runtime.Serialization.DataMember]
        public List<Contract> Contracts
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the departments.
        /// </summary>
        /// <value>The departments.</value>
        [System.Runtime.Serialization.DataMember]
        public List<Department> Departments
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        [System.Runtime.Serialization.DataMember]
        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the address.
        /// </summary>
        /// <value>The address.</value>
        [System.Runtime.Serialization.DataMember]
        public string Address
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the phone number.
        /// </summary>
        /// <value>The phone number.</value>
        [System.Runtime.Serialization.DataMember]
        public string PhoneNumber
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the fax number.
        /// </summary>
        /// <value>The fax number.</value>
        [System.Runtime.Serialization.DataMember]
        public string FaxNumber
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the email address.
        /// </summary>
        /// <value>The email address.</value>
        [System.Runtime.Serialization.DataMember]
        public string EmailAddress
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the web site.
        /// </summary>
        /// <value>The web site.</value>
        [System.Runtime.Serialization.DataMember]
        public string WebSite
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the social security number.
        /// </summary>
        /// <value>The social security number.</value>
        [System.Runtime.Serialization.DataMember]
        public string SocialSecurityNumber
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the tax code.
        /// </summary>
        /// <value>The tax code.</value>
        [System.Runtime.Serialization.DataMember]
        public string TaxCode
        {
            get;
            set;
        }

        #endregion

        #region Mehods

        /// <summary>
        /// Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
        /// </summary>
        /// <param name="x">The first object to compare.</param>
        /// <param name="y">The second object to compare.</param>
        /// <returns>
        /// A signed integer that indicates the relative values of <paramref name="x"/> and <paramref name="y"/>, as shown in the following table.Value Meaning Less than zero <paramref name="x"/> is less than <paramref name="y"/>. Zero <paramref name="x"/> equals <paramref name="y"/>. Greater than zero <paramref name="x"/> is greater than <paramref name="y"/>.
        /// </returns>
        /// <exception cref="T:System.ArgumentException">Neither <paramref name="x"/> nor <paramref name="y"/> implements the <see cref="T:System.IComparable"/> interface.-or- <paramref name="x"/> and <paramref name="y"/> are of different types and neither one can handle comparisons with the other. </exception>
        public override int Compare(object x, object y)
        {
            if (ERP.Framework.Components.Utilities.ComparingHelper.ComapringManager.CompareTypes(x, y))
                return ((Company)x).Name.CompareTo(((Company)y).Name);
            return -1;
        }

        #endregion
    }
}
